package com.develrage.prinance.soapws;

import java.util.HashMap;

public class GeneralFaultImpl extends GeneralFault
{
    private HashMap<Integer, String> errors;
    
    public GeneralFaultImpl()
    {
	errors = new HashMap<Integer, String>();
	
	// Application related
	errors.put(101, "Database connection error");
	
	// Storage related
	errors.put(200, "Storage not found");
	errors.put(201, "Invalid StorageName");
	errors.put(202, "Invalid StorageCode");
    }
    
    public GeneralFault getInstance(int errorcode)
    {	
	GeneralFault fault = new GeneralFault();
	if (errors.containsKey(errorcode))
	{
	    fault.setFaultCode(errorcode);
	    fault.setFaultString(errors.get(errorcode));
	}
	else {
	    fault.setFaultCode(-1);
	    fault.setFaultString("Undefined GeneralFaultException");
	}
	
	
	return fault;
    }
}
